<?php

include('../../common.php');
if($_SESSION['log_islogin'] == 'yes' ){
	
	$id = intval(mysql_real_escape_string($_GET['trnID']));
	
	$qCheck= "SELECT count(*)
					FROM transport t , person_transport_delivering ptd, person p
					WHERE t.trn_id=ptd.ptd_trn_id
					AND p.per_id=ptd.ptd_person_per_id 
					AND ptd_date_assign_driver =  DATE_FORMAT(NOW(),'%y-%m-%d')
					AND t.trn_id = '$id' ";
	$rCheck = $db->sql_total($qCheck);
	
	if($rCheck > 0){
	
		$qList= "SELECT t.trn_id as transportid ,t.trn_plate_no as plateno,
						ptd.ptd_created_date as assigndate,
						p.per_full_name as name,p.per_identity_no  as icno
						FROM transport t , person_transport_delivering ptd, person p
						WHERE t.trn_id=ptd.ptd_trn_id
						AND p.per_id=ptd.ptd_person_per_id 
						AND ptd_date_assign_driver =  DATE_FORMAT(NOW(),'%y-%m-%d')
						AND t.trn_id = '$id'	";
		$rList = $db->sql_list($qList);
		
		echo $rList['name'] ;
		
		
	}else{
		echo '0';
	}
											
}else{
	echo 'Dude!';
}

?>
